package com.cskaoyan.controller.wx_order_before;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.PageDataVo;
import com.cskaoyan.bean.configmanagement.WX;
import com.cskaoyan.bean.promote.enumbean.CouponStatusEnum;
import com.cskaoyan.bean.wx_order_before.base.OrderBeforePageData;
import com.cskaoyan.bean.wx_order_before.base.OrderBeforeParam;
import com.cskaoyan.bean.wx_order_before.bo.OrderPrepayBo;
import com.cskaoyan.bean.wx_order_before.bo.OrderSubmitBo;
import com.cskaoyan.bean.wx_order_before.vo.OrderSubmitVo;
import com.cskaoyan.bean.wx_resp.WxRespVo;
import com.cskaoyan.controller.wx_order_before.exception.SubmitOrderException;
import com.cskaoyan.service.wx_order_before.WXOrderServiceBefore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("wx/order")
public class WXOrderControllerBefore {
    @Autowired
    WXOrderServiceBefore wxOrderService;

    @GetMapping("list")
    public BaseRespVo listOrders(OrderBeforeParam orderBeforeParam,Integer showType) {
        OrderBeforePageData data = wxOrderService.listOrders(showType,orderBeforeParam);
        return BaseRespVo.ok(data);
    }

    @PostMapping("submit")
    public WxRespVo submitOrder(@RequestBody OrderSubmitBo orderSubmitBo) throws SubmitOrderException {
        wxOrderService.submitOrder(orderSubmitBo);
        return WxRespVo.ok();
    }

    @PostMapping("prepay")
    public WxRespVo prepay(@RequestBody OrderPrepayBo orderPrepayBo) throws SubmitOrderException {
        wxOrderService.orderPrepay(orderPrepayBo.getOrderId());
        return WxRespVo.ok();
    }






}
